package com.lzc.springPart.BeanFactoryPostProcess;

import com.lzc.springPart.BeanFactoryPostProcess.bean.HelloBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.GenericApplicationContext;

import java.lang.reflect.GenericArrayType;

public class RunMain {

    public static void main(String[] args) {

        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("config",Config.class);

        context.registerBean(ComponentScanPostProcess.class);
        context.registerBean(GetBeanPostProcess.class);

        context.refresh();

        for (String beanDefinitionName : context.getBeanDefinitionNames()) {

            System.out.println(beanDefinitionName);
        }

    }

    @Configuration
    @ComponentScan("com.lzc.springPart.BeanFactoryPostProcess")
    static class Config{

        @Bean
        public HelloBean helloBean(){
            return new HelloBean();
        }
    }
}
